import axios, { AxiosInstance } from 'axios';

const instance: AxiosInstance = axios.create({
  //本地开发用
  //baseURL: '/api',

  //上服务器用
  baseURL: 'https://api.bimface.com/data/v2',
});

// 请求拦截器
instance.interceptors.request.use((config: any) => {
  return config;
});

// 响应拦截器
instance.interceptors.response.use((response) => {
  if (response.status === 200 || response.status === 201 || response.status === 204) {
    return response;
  } else {
    alert(response.status);
  }
});

export default instance;
